﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLibary;

namespace Medicare
{
    public partial class FrmSelectTradeTypeForRZ : Form
    {
        public FrmSelectTradeTypeForRZ()
        {
            InitializeComponent();
            dataBlind();
        }
        public FrmSelectTradeTypeForRZ(string balance)
        {
            InitializeComponent();
            txtMoney.Text = balance;
            dataBlind();
        }


        private YBBZInfoFacade ybbzFacade;
        private string _bzbm = string.Empty;//病种编码
        private string _bzmc = string.Empty;//病种名称
        private string _medType = string.Empty;//医疗类别
        private string _accountPay = string.Empty;//是否使用账户支付
        private string _reasonLeaveHos;//出院原因

        private string _accountBalance = string.Empty;

        public string AccountBalance
        {
            get { return _accountBalance; }
            set { _accountBalance = value; }
        }

        public string bzbm
        {
            get { return _bzbm; }
            set { _bzbm = value; }
        }
        public string bzmc
        {
            get { return _bzmc; }
            set { _bzmc = value; }
        }
        public string medType
        {
            get { return _medType; }
            set { _medType = value; }
        }
        public string accountPay
        {
            get { return _accountPay; }
            set { _accountPay = value; }
        }
        public string reasonLeaveHos
        {
            set { _reasonLeaveHos = value; }
            get { return _reasonLeaveHos; }
        }


        private void FrmSelectTradeTypeForRZ_Load(object sender, EventArgs e)
        {

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (bzbm.Equals(string.Empty))
            {
                MessageBox.Show("请选择病人的出院诊断!");
                lookUpEditEx1.Focus();
                return;
            }
            //medType=cbxmedType.SelectedItem.ToString().Split('_')[0].Trim();
            reasonLeaveHos = cboReasonOuthos.SelectedItem.ToString().Split('_')[0].Trim();
            if (cbxNo.Checked)
            {
                accountPay = "0";
            }
            else
            {
                accountPay = "1";
            }
            _accountBalance = txtMoney.Text;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void lookUpEditEx1_QueryCloseUp(object sender, CancelEventArgs e)
        {
            if (null == lookUpEditEx1.SelectedRow)
            {

                return;

            }
            DataRow row = lookUpEditEx1.SelectedRow;
            bzbm = row["JBBM"].ToString();
            bzmc = row["JBMC"].ToString();
        }

        private void dataBlind()
        {
            ybbzFacade = new YBBZInfoFacade();
            DataSet ds = ybbzFacade.FindAll();
            lookUpEditEx1.Table = ds.Tables[0];
            cboReasonOuthos.SelectedIndex = 0;
            //cbxmedType.SelectedIndex=0;
        }

        private void cbxNo_Click(object sender, EventArgs e)
        {
            if (cbxYes.Checked)
            {
                cbxYes.Checked = false;
                cbxNo.Checked = true;
            }
        }

        private void cbxYes_Click(object sender, EventArgs e)
        {
            if (cbxNo.Checked)
            {
                cbxNo.Checked = false;
                cbxYes.Checked = true;
            }
        }
    }
}
